CS-04 : DATA STRUCTURE THROUGH 'C' & PASCAL  DEC 1995
 

Time : 2 Hours  

Max. Marks : 60


NOTE
: Question 1 is compulsory. Attempt any three from the rest.  Algorithms should be written near to C or Pascal language statements.

 

1. (a). Write a C program using pointer in a function to insert-string (string, substring, location) to insert the substring into the string at the character location specified.
  (b). Write an algorithm to support insertion and deletion of anode into binary search tree recursively.
  (c). Draw all distinct Binary tree with 3 vertices.
  (d).  Explain briefly, using a simple example, the logic of the Quicksort algorithm.  Write a recursive algorithm for Quicksort and show how Quicksort would sort the array 4,3,1,6,7,2,5,8.
2. (a). Write the Postfix from of the following expression :
    (A - B) * X + Y / (F - C * E) + D
X and Y or NOT (A > B)
  (b). Write an algorithm to construct a stack using a linked list.
3. (a). Differentiate between Binary tree and B-tree.
  (b) Write a recursive algorithm to traverse Binary tree through Preorder and Postorder.
4. (a). What is recursion ?  Discuss its advantages and disadvantages.
  (b). Write an algorithm to evaluate an arithmetic expression using stack and show how the expression 3 * (5 - 3) will be evaluated.
5.  (a).  What is the difference between stack and queue?
  (b). Assuming a queue representation through circular array, write algorithm for addition and deletion of an element into queue.
6. (a). Draw an AVL tree for nodes 25, 45,50,55,60,65,75,85 and explain all its stages.
  (b). Write an algorithm to delete a node into AVL tree.